﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using NewDDSys.Entity;
using NewDDSys.IBLL;
using NewDDSys.IDAL;
using NewDDSys.Factory;
using NewDDSys.Utility;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Web_UptJddx : System.Web.UI.Page
{
    private string num = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        num = Request.QueryString["Num"];
        if (!IsPostBack)
        {
            
            btnUpt.Attributes.Add("onclick", "javascript:if(confirm('" + "确认无误，并修改么？" + "')== false) return false;");
            DataSet ds = BLLFactory.CreateJddxBLL().Select(num);
            if (ds == null)
                Response.Write(" <script   language=javascript> window.alert( '无此记录，请联系管理员！ ');</script> ");
            else
            {
                txtNUM.Text = num;
                txtNUM.Attributes["contentEditable"] = "false";
                txtBanbie.Text = ds.Tables[0].Rows[0]["banbie"].ToString();

                txtBanzu.Text = ds.Tables[0].Rows[0]["banzu"].ToString();
                txtKn.Text = ds.Tables[0].Rows[0]["kn"].ToString();
                txtKw.Text = ds.Tables[0].Rows[0]["kw"].ToString();
                txtZn.Text = ds.Tables[0].Rows[0]["zn"].ToString();
                txtHx.Text = ds.Tables[0].Rows[0]["hx"].ToString();
            }
        }
        

    }
    protected void btnDel_Click(object sender, EventArgs e)
    {
        int f = BLLFactory.CreateJddxBLL().Del(num);
        if (f >= 1)
            Response.Write(" <script   language=javascript> window.alert( ' 删除成功！ ');</script> ");
        Response.Redirect("DXJL.aspx");
    }
    protected void btnUpt_Click(object sender, EventArgs e)
    {
        int f = BLLFactory.CreateJddxBLL().UpdateJddx(num, txtBanbie.Text.ToString(), txtBanzu.Text.ToString(), Convert.ToInt32(txtKn.Text.ToString()), Convert.ToInt32(txtKw.Text.ToString()), Convert.ToInt32(txtZn.Text.ToString()), Convert.ToDecimal(txtHx.Text.ToString()));
        if (f >= 1)
            Response.Write(" <script   language=javascript> window.alert( ' 修改成功！ ');</script> ");
        Response.Redirect("DXJL.aspx");
    }
}
